package java8.timeutil;

import java.time.OffsetDateTime;
import java.time.ZoneOffset;

/**
 * @author Cheng Jun
 * @version 1.0
 * Description:
 * @date 2019/8/15 15:32
 */
public class OffsetDateTimeStudy {

    public static void main(String[] args) {
        // 2019-08-15T15:45:51.580+08:00
        OffsetDateTime offsetDateTime = OffsetDateTime.now();
        ZoneOffset zoneOffset = ZoneOffset.of("+16:00");
        // 2019-08-15T15:45:51.580+16:00
        OffsetDateTime offsetSameLocal = offsetDateTime.withOffsetSameLocal(zoneOffset);
        // 2019-08-15T15:45:51.580+16:00
        OffsetDateTime offsetSameInstant = offsetDateTime.withOffsetSameInstant(zoneOffset);

        System.out.println(offsetDateTime);
        System.out.println(offsetSameLocal);
        System.out.println(offsetSameInstant);
    }
}
